package net.zxteam.solutions.java.rs_sync;

import java.io.File;

public abstract class RSSync {

	public static RSSync newInstance() throws RSSyncException {

		try { return new SVNRSSyncImplAllRepository(); }
		catch(Exception ex) { 

			if(ex instanceof RSSyncException)
				throw (RSSyncException)ex;

			throw new RSSyncException(ex); 
		}
	}

	public abstract void setTempDirectory(File directory);
	
	public final String getDestinationRepositoryUrl() { synchronized (this) { return _targetRepositoryUrl; }}
	public final void setDestinationRepositoryUrl(String destinationRepositoryUrl) { synchronized (this) { _targetRepositoryUrl = destinationRepositoryUrl; }}

	public abstract void setSourceAuthentication(String username, String password);
	public abstract void setDestinationAuthentication(String username, String password);

	public abstract void init(String sourceRepositoryUrl, long sourceRevision) throws RSSyncException;
	public abstract void sync() throws RSSyncException;

	protected RSSync() {
		// TODO Auto-generated constructor stub
	}

	private String _targetRepositoryUrl;
}
